Skip to content

Use SDL_PollEvent instead of Event Filters#727

Open
tophyr wants to merge 1 commit intoDescentDevelopers:mainfrom
tophyr:pr/poll-sdl-events
Open

Use SDL_PollEvent instead of Event Filters#727
tophyr wants to merge 1 commit intoDescentDevelopers:mainfrom
tophyr:pr/poll-sdl-events

Conversation

@tophyr
Copy link
Contributor

@tophyr tophyr commented Jan 21, 2026

Pull Request Type

  • GitHub Workflow changes
  • Documentation or Wiki changes
  • Build and Dependency changes
  • Runtime changes
    • Render changes
    • Audio changes
    • Input changes
    • Network changes
    • Other changes

Description

SDL EventFilters were always the incorrect way to handle input, but now in SDL3 are even more incorrect as they run on the thread that accepts the input, not the thread that's intended to handle it. (This is a significant difference on Android and iOS.)

The fix is surprisingly simple: Just poll for input in the OS defer handler. This is already called at the start of every type of every frame, so it is the perfect place to grab input.

Related Issues

Checklist

  • I have tested my changes locally and verified that they work as intended.
  • I have documented any new or modified functionality.
  • I have reviewed the changes to ensure they do not introduce any unnecessary complexity or duplicate code.
  • I understand that by submitting this pull request, I am agreeing to license my contributions under the project's license.

SDL EventFilters were *always* the incorrect way to handle input, but now in SDL3 are even more incorrect as they run on the thread that accepts the input, not the thread that's intended to handle it. (This is a significant difference on Android and iOS.)

The fix is surprisingly simple: Just poll for input in the OS defer handler. This is already called at the start of every type of every frame, so it is the perfect place to grab input.
@Lgt2x Lgt2x mentioned this pull request Jan 21, 2026
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant